<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<!DOCTYPE html >
<html>
<head>
<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript" src="webpage/com/zybk/file_upload/uploadChangeRecord.js"></script>
<script type="text/javascript">
$(function(){
	$("#file_upload").uploadify({
		buttonText:'上传文件',
		auto:true,
		progressData:'speed',
		multi:false,
		height:20,
		width:55,
		overrideEvents:['onDialogClose'],
		fileTypeDesc:'文件格式:',
		queueID:'instructionfile',
		fileTypeExts:'*.xlsx;',
		fileSizeLimit:'15MB',
		swf:'plug-in/uploadify/uploadify.swf',	
		uploader:'uploadChangeRecordController.do?importExcel',
		onUploadStart : function(file) { 
			var documentTitle=$('#documentTitle').val();
			$('#file_upload').uploadify("settings", 
				"formData", {'documentTitle':documentTitle}
			);
			lockmask(true,'请稍等,导入中...');
			//$('#file_upload').fadeOut();
		},
		onUploadSuccess : function(file, responseData, response) {
			lockmask(false);
			var data = $.parseJSON(responseData);
			if(data.success){
				$.ajax({
					url : "uploadChangeRecordController.do?readExcel",
					data : {
						"filePath" : data.obj
						},
					cache : false,
					async : false,
					dataType : 'json',
					type : 'POST'
				});
				top.window.tip(data.msg);
				frameElement.api.reload(win,"zySpareRecordController.do?zySpareRecord");
				frameElement.api.close();
			}else{
				//$("#file_upload").fadeIn();
				tip(data.msg);
			}
		},onFallback : function(){
			tip("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试")
		},onSelectError : function(file, errorCode, errorMsg){
			switch(errorCode) {
				case -100:
					tip("上传的文件数量已经超出系统限制的"+$('#instruction').uploadify('settings','queueSizeLimit')+"个文件！");
					break;
				case -110:
					tip("文件 ["+file.name+"] 大小超出系统限制的"+$('#instruction').uploadify('settings','fileSizeLimit')+"大小！");
					break;
				case -120:
					tip("文件 ["+file.name+"] 大小异常！");
					break;
				case -130:
					tip("文件 ["+file.name+"] 类型不正确！");
					break;
				}
		},onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
	});
});
</script>
</head>
<body style="overflow-y: hidden" scroll="no">
 <form  enctype="multipart/form-data" >
	<span id="file_upload"></span>
	<span id="msg"></span>
	</form>
</body>
</html>